package GreedyAlgorithm;
/*
 * 跳跃游戏
 */
public class lc55 {

    public boolean canJump(int[] nums) {
        int count = 0;
        if (nums.length == 1) return true;
        for (int i = 0; i <= count; i++) {
            count = Math.max(count, i + nums[i]);
            if (count >= nums.length - 1) {
                return true;
            }
        }
        return false;
    }

}
